<?php
session_start();
echo "<br/><br/><br/><br/><br/>";

?>
<html>
<head>
	<meta charset="UTF-8" >
	<link rel="stylesheet" type="text/css" href="css/index.css">
    <link href="themes/4/js-image-slider.css" rel="stylesheet" type="text/css" />
    <script src="themes/4/js-image-slider.js" type="text/javascript"></script>
    <title>FREEBED</title>
</head>
<body>
<?php include('menu.php');
?>


    <div id="sliderFrame">
        <div id="slider">
            <img src="images/chambre1.jpg" align="middle" width="100%" height="400px" />
            <img src="images/salledebain1.jpg" align="middle" width="100%" height="400px"/>
            <img src="images/salon1.jpg" align="middle" width="100%" height="400px"/>
            <img src="images/chambre2.jpg" align="middle" width="100%" height="400px" />
            <img src="images/chambre3.jpg" align="middle" width="100%" height="400px" />
            <img src="images/chambre4.jpg" align="middle" width="100%" height="400px" />
            <img src="images/chambre5.jpg" align="middle" width="100%" height="400px" />
            <img src="images/cuisine1.jpg" align="middle" width="100%" height="400px" />
            <img src="images/jackouzi1.jpg" align="middle" width="100%" height="400px" />
            <img src="images/terrasse1.jpg" align="middle" width="100%" height="400px" />
        </div>

        <div class="group1-Wrapper">
            <a onclick="imageSlider.previous()" class="group1-Prev"></a>
            <a onclick="imageSlider.next()" class="group1-Next"></a>
        </div>

        <div style="text-align:center;padding:20px;z-index:20;">
            <a onclick="imageSlider.previous()" class="group2-Prev"></a>
            <a id='auto' onclick="switchAutoAdvance()"></a>
            <a onclick="imageSlider.next()" class="group2-Next"></a>
        </div>
    </div>

    <script type="text/javascript">

        function switchAutoAdvance() {
            imageSlider.switchAuto();
            switchPlayPauseClass();
        }
        function switchPlayPauseClass() {
            var auto = document.getElementById('auto');
            var isAutoPlay = imageSlider.getAuto();
            auto.className = isAutoPlay ? "group2-Pause" : "group2-Play";
            auto.title = isAutoPlay ? "Pause" : "Play";
        }
        switchPlayPauseClass();
    </script>
	
	<div id="louer">
		<?php        		
		mysql_connect("localhost", "root","" );  
		mysql_select_db("fbdb");  
		$sql = mysql_query("SELECT * FROM location" );  
		while($data = mysql_fetch_array($sql))  
			{  
				?>
				<div id="location">
					<div id="image">
						<?php 
						echo "<img src=\"" .  $data['location_couv']  . "\"/>";
					echo "</div>";
					
					echo "<div id=\"description\">";
						echo "<b>Adresse : </b>" . $data['location_voie'] . "</br>";
						echo "<b>Description : </b>" . $data['location_desc'] . "</br>";
						echo "<b> Tarif journalier // hebdomadaire : </b>" . $data['location_tarifj'] . " € // " . $data['location_tarifh'] . " €";
                        echo "<input type='hidden' value='".$data['location_id']."'/>";
						?>
					</div>
					<div id="lien">
                    <form action="detail_location.php" method="post">
						<input type="submit" name="lien1" value="Plus de détails" onclick="self.location.href='detail_location.php'" style="color:#2c3e50; font-weight:bold"onclick>
						<input type="button" name="lien1" value="Louer !" onclick="self.location.href='louer.php'" style="color:#2c3e50;  font-weight:bold"onclick> 
					</form>
                    </div>
				</div>
				<?php } ?> 
				
		
</body>
<footer>
<div border="1px solid black">
				
				<?php
if(file_exists('compteur_visites.txt'))
{
$compteur_f = fopen('compteur_visites.txt', 'r+');
$compte = fgets($compteur_f);
}
else
{
$compteur_f = fopen('compteur_visites.txt', 'a+');
$compte = 0;
}
if(!isset($_SESSION['compteur_de_visite']))
{
$_SESSION['compteur_de_visite'] = 'visite';
$compte++;
fseek($compteur_f, 0);
fputs($compteur_f, $compte);
}
fclose($compteur_f);
echo '<strong>'.$compte.'</strong> visites.';
?>
</div>

</footer>


		
</body>
</html>
